package com.linewell.dao.impl;

import com.linewell.dao.ArticleMapper;
import com.linewell.entity.Article;
import com.linewell.entity.ArticleVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Title: ssm2
 * @description:
 * @author: hyuhuang@linewell.com
 * @since:2018/1/17 13:43
 */
@Repository
public class ArticleDao implements ArticleMapper {

    @Autowired
    private ArticleMapper articleMapper;

    public List<Article> selectArticleWithUserId(Long userId) {
        return articleMapper.selectArticleWithUserId(userId);
    }

    public List<Article> selectAllArticle() {
        return articleMapper.selectAllArticle();
    }

    public boolean addArticle(Article article) {
        return articleMapper.addArticle(article);
    }

    public boolean updataArticleZan(Long arcticleID, int zanNum){return articleMapper.updataArticleZan(arcticleID,zanNum);}

    public Article selectArticleWithArticleId(Long articleId) {
        return articleMapper.selectArticleWithArticleId(articleId);
    }

    public Long getUserName(long articleId) {
        return articleMapper.getUserName(articleId);
    }

    public List<Article> selectById(long id) {
        return articleMapper.selectById(id);
    }

    public List<Article> selectByTagId(Long tagId,int page) {
        return articleMapper.selectByTagId(tagId,page);
    }

    public List<Article> selectBySort(Integer page, String sort) {
        return articleMapper.selectBySort(page, sort);
    }

    public List<Article> searchArticle(String searchType,String keyword,Integer page) {
        return articleMapper.searchArticle(searchType,keyword,page);
    }

    public Article selectArticleByArticleId(Long articleId) {
        return articleMapper.selectArticleByArticleId(articleId);
    }

    public List<Article> getBestRank(int page) {
        return articleMapper.getBestRank(page);
    }

    public List<ArticleVo> searchArticleKey(String articleKey) {
        return articleMapper.searchArticleKey(articleKey);
    }

    public List<ArticleVo> searchAllArticle(int page,int limit) {
        return articleMapper.searchAllArticle(page, limit);
    }

    public boolean updataArticleCheck(Long articleId,int acheck) {
        return articleMapper.updataArticleCheck(articleId,acheck);
    }

    public boolean deleteArticleByArticleId(Long articleId) {
        return articleMapper.deleteArticleByArticleId(articleId);
    }

    public int getCount() {
        return articleMapper.getCount();
    }

    public boolean updateArticle(String field, String value, Long articleId) {
        return articleMapper.updateArticle(field,value,articleId);
    }

    public boolean deleteAllArticle(String articleIds) {
        return articleMapper.deleteAllArticle(articleIds);
    }

    public int getCountIsCheck() {
        return articleMapper.getCountIsCheck();
    }

    public List<ArticleVo> searchAllArticleIsCheck(int page, int limit) {
        return articleMapper.searchAllArticleIsCheck(page,limit);
    }

    public boolean updateArticle1(Article article) {
        return articleMapper.updateArticle1(article);
    }
}
